﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iLangl.Plugin
{
	public class ConfigurationFactory : IConfigurationFactory
	{
		#region Singelton Pattern
		private ConfigurationFactory()
		{
		}

		private static ConfigurationFactory instance;
		private static object mutex = new object();
		/// <summary>
		/// The instance of the CompanyManager.
		/// </summary>
		public static ConfigurationFactory Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							instance = new ConfigurationFactory();
						}
					}
				}
				return instance;
			}
		}
		#endregion

		private IConfigurationFactory _factory;
		public void Initialize(IConfigurationFactory factory)
		{
			_factory = factory;
		}

		#region IConfigurationFactory Members

		public IPluginConfiguration CreatePluginConfiguration()
		{
			return _factory.CreatePluginConfiguration();
		}

		public IConfigurationManager CreateConfigurationManager()
		{
			return _factory.CreateConfigurationManager();
		}

		#endregion
	}
}
